

const mongoose = require("mongoose")


// const dbhost = "101.200.156.129"
const dbhost = "localhost"
const dbport = 27017
const dbName = "wh2105"
const dbuser = "?"
const dbpass = "?"

const connurl = `mongodb://${dbhost}:${dbport}/${dbName}`

mongoose.connect(connurl, { useNewUrlParser: true, useUnifiedTopology: true }, (err) => {
    if (err) {
        console.log(err)
        console.log("数据库链接失败")
    } else {
        console.log("数据库链接成功")
    }
});

const db = mongoose.connection

module.exports.db = db

